package com.tunnel.client.tcp;

import com.tunnel.common.tcp.TcpBaseTask;

public class TcpDataSenderManager {

    public volatile static TcpDataQueue QUEUE = new TcpDataQueue();

    public static void startQueue() {
    	QUEUE.startQueue();
	}
    
	public static TcpDataQueue getQueue() {
		return QUEUE;
	}
	
	public static void commitData(TcpBaseTask task,byte[] ...datas){
		TcpData data = new TcpData(task, datas);
		boolean addSuccess = QUEUE.addDataToQueue(data);
		while(!addSuccess){
			try {
				Thread.sleep(100);
			} catch (Exception e) {}
			addSuccess = QUEUE.addDataToQueue(data);
		}
    }
    
}
